<style lang="less">
    @import "./home.less";
</style>
<template>
    <div class="home-main">
        <Row :gutter="8">
            <!--快捷操作按钮-->
            <Col span="16">
                <Card>
                    <p slot="title">快捷操作</p>
                    <Row type="flex" :gutter="16">
                        <Col span="8" v-if="checkPermission('1107')">
                            <Card class="jumpCard" @click.native="toArticlePost">
                                <div style="text-align:center">
                                    <Icon type="edit" size="40" color="#2d8cf0"></Icon>
                                    <h3>发布文章</h3>
                                </div>
                            </Card>
                        </Col>
                        <Col span="8" v-if="checkPermission('1129')">
                            <Card class="jumpCard" @click.native="toServicePost">
                                <div style="text-align:center">
                                    <Icon type="compose" size="40" color="#2d8cf0"></Icon>
                                    <h3>发布平台服务</h3>
                                </div>
                            </Card>
                        </Col>
                        <Col span="8" v-if="checkPermission('1123')">
                            <Card class="jumpCard" @click.native="toNewsManage">
                                <div style="text-align:center">
                                    <Icon type="email" size="40" color="#2d8cf0"></Icon>
                                    <h3>消息管理</h3>
                                </div>
                            </Card>
                        </Col>
                    </Row>
                </Card>
            </Col>
            <!--管理员基本信息面板-->
            <Col span="8">
                <Card>
                    <Row class="user-infor">
                        <Col>
                            <div style="text-align:center">
                                <b class="card-user-infor-name">{{userInfo.username}}</b>
                            </div>
                        </Col>
                    </Row>
                    <Row>
                        <Col span="8"><p class="notwrap">上次登录时间:</p></Col>
                        <Col span="16" class="padding-left-8">{{ userInfo.last_login_log ? new Date(parseInt(userInfo.last_login_log.create_time)).toLocaleDateString()+" "+new Date(parseInt(userInfo.last_login_log.create_time)).getHours()+":"+new Date(parseInt(userInfo.last_login_log.create_time)).getMinutes(): "首次登陆" }}</Col>
                    </Row>
                    <Row>
                        <Col span="8"><p class="notwrap">上次登录地点:</p></Col>
                        <Col span="16" class="padding-left-8">{{ userInfo.last_login_log ? userInfo.last_login_log.ip_location : "首次登陆" }}</Col>
                    </Row>
                </Card>
            </Col>
        </Row>
        <!--管理员待办事项-->
        <Row>
            <Card style="margin-top:5px">
                <p slot="title">待办事项</p>
                <backlog></backlog>
            </Card>
        </Row>
        <!--网站数据分析图表-->
        <Card style="margin-top:5px">
            <p slot="title">网站数据统计</p>
            <data-analysis v-if="checkPermission('1136')"></data-analysis>
        </Card>
    </div>
</template>

<script>
import Parent from '../Parent'
import Backlog from "./backlog"
import DataAnalysis from "./DataAnalysis"

export default {
    name: 'home',
    extends: Parent,
    components:{
        Backlog, DataAnalysis
    },
    data () {
        return {
        };
    },
    methods:{
        toArticlePost(){
            this.$router.push({ name: "info_list"});
        },
        toServicePost(){
            this.$router.push({ name: "release_plateformservice"});
        },
        toNewsManage(){
            this.$router.push({ name: "message_manage"});
        },
    },
    created () {
    }
};
</script>